; docformat = 'rst'
;
;+
;
; :Purpose:
;   Create CELS directory structure
;   
; :Inputs:
;   Case_name: simulation name
;   
; :Keywords:
;
; :Outputs:
;   Creates required directories in CELS input and output directories specified in cels_path.pro
;   
; :Example::
;   IDL> cels_directories, 'SF6'
;   
; :History:
; 	Written by: Matt Rigby, MIT, Oct 11, 2011
;
;-
pro cels_directories, case_name, mozart=mozart, metropolis=metropolis

  compile_opt idl2
  on_error, 2

  cels_dir_suffix=['', 'EUM', 'measurements', 'emissions', '']
  input=[1, 1, 1, 1, 0]
  output=[0, 0, 0, 0, 1]
  
  if keyword_set(mozart) then begin
    cels_dir_suffix=[cels_dir_suffix, 'emissions/MOZART']
    input=[input, 1]
    output=[output, 0]
  endif
  if keyword_set(metropolis) then begin
    cels_dir_suffix=[cels_dir_suffix, 'metropolis']
    input=[input, 1]
    output=[output, 0]
  endif
  
  for di=0, n_elements(cels_dir_suffix)-1 do begin
    dir_name=cels_filestr(input=input[di], output=output[di], case_name + '/' + cels_dir_suffix[di])
    search_name=file_search(dir_name)
    if search_name eq '' then begin
      print, strcompress('CELS_DIRECTORIES: creating directory ' + dir_name)
      file_mkdir, dir_name
    endif else begin
      print, strcompress('CELS_DIRECTORIES: skipping existing directory ' + dir_name)
    endelse
  endfor

end